upstream iipsrv {
    server localhost:9900;
}

fastcgi_cache_path /data/cache/nginx levels=1:2 keys_zone=iipsrv:256m inactive=1h max_size=1G;

server {
    listen      8900;
    charset     utf-8;
    add_header 'Access-Control-Allow-Origin' '*';
    location / {
        fastcgi_pass iipsrv;
        fastcgi_intercept_errors on;
        fastcgi_buffering off;
        fastcgi_cache iipsrv;
        fastcgi_cache_key "$scheme$request_method$host$request_uri";
        fastcgi_cache_valid 200 302 60m;
        fastcgi_cache_bypass $http_pragma    $http_authorization;
        include fastcgi_params;
        fastcgi_param   PATH_INFO $fastcgi_script_name;
        fastcgi_param   REQUEST_METHOD $request_method;
        fastcgi_param   QUERY_STRING $query_string;
        fastcgi_param   CONTENT_TYPE $content_type;
        fastcgi_param   CONTENT_LENGTH $content_length;
        fastcgi_param   SERVER_PROTOCOL $server_protocol;
        fastcgi_param   REQUEST_URI $request_uri;
        fastcgi_param   HTTPS $https if_not_empty;
        # "spoof" external proxy to set correct server URL in info.json.
        fastcgi_param   HTTP_HOST http://localhost:8900;
    }
}
